package org.example.myleet.p1464;

import java.util.Comparator;
import java.util.PriorityQueue;

public class Solution {
    public int maxProduct(int[] nums) {
        PriorityQueue<Integer> heap = new PriorityQueue<>(Comparator.reverseOrder());
        for (int num : nums) {
            heap.offer(num);
        }
        return (heap.poll() - 1) * (heap.poll() - 1);
    }
}
